import grails.converters.JSON
class TeacherAjaxController {

    def index = { }

    def validLoginName = {
        log.info (School.count())
        if(Teacher.countByUsernameAndSchool(params.name+"-${session.school.id}",session.school) > 0){
            return render(['success':'1','message' : '<font color="green"> 此登录名已被使用！</font>'] as JSON) 
        }else{
            return render(['success':'1','message' : '此登录名可用！'] as JSON) 
        }        
    }
}
